{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$info.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>协议类型：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select class="input-text" style="width:120px" name="type">
                    <option value="1" {if condition="$info.type eq 1"}selected{/if}>用户协议</option>
                    <option value="2" {if condition="$info.type eq 2"}selected{/if}>隐私协议</option>
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>协议内容：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <script id="editor" type="text/plain" style="height:400px">{$info.content}</script>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script>window.UEDITOR_HOME_URL = '__LIB__/ueditor/1.4.3/'</script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
                <script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>
    $(function () {
        var ue = UE.getEditor('editor',{
            serverUrl:'{:\\think\\Url::build("Ueditor/index")}'
            , toolbars: [[
                'fullscreen', 'source', '|', 'undo', 'redo', '|',
                'bold', 'italic', 'underline',  '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
                'simpleupload'
            ]]
        });
        var converter = new showdown.Converter(),
            text      = $("#markdown_tpl").html();
        $("#markdown").html(converter.makeHtml(text));
    })

    $("#form").Validform({
        tiptype: 2,
        ajaxPost: true,
        showAllError: true,
        callback: function (ret) {
            ajax_progress(ret);
        }
    });

</script>

{/block}